package com.thkj.modules.file.service.impl;

import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thkj.modules.file.entity.TblDistrict;
import com.thkj.modules.file.service.TblDistrictService;

import dp.dao.PagingList;
import dp.service.BaseService;

@Service
public class TblDistrictServiceImpl extends BaseService implements TblDistrictService {
    public void insertTblDistrict(TblDistrict t){
        dao.insert("com.thkj.mapper.TblDistrict.insert", t);
    }

    public int updateTblDistrict(TblDistrict t){
        int row = dao.update("com.thkj.mapper.TblDistrict.update", t);
        return row;
    }

    @Transactional
    public int deleteTblDistrict(String t ){
    	//首先查询有没有下级
        return dao.delete("com.thkj.mapper.TblDistrict.delete", t);
    }

    public TblDistrict getTblDistrictById(String t){
        return dao.queryForObject("com.thkj.mapper.TblDistrict.getById", t, TblDistrict.class);
    }

	@Override
	public PagingList<Map> query(int pageIndex, int pageSize, Map<String, Object> param) {
		return dao.queryForPagingList("com.thkj.mapper.TblDistrict.query",param, pageIndex, pageSize, Map.class);
	}

}